<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
        <script src="../js/jquery-3.4.1.min.js"></script>
        <script>
            $(function(){
                $("#add").click(function () {
                    var value=$("#num").val()*1;
                    value++;
                    $("#num").val(value);
                });
                $("#minus").click(function () {
                    var value=$("#num").val()*1;
                    if(value>0){
                        value--;
                        $("#num").val(value);
                    }else{
                        alert("已经不可以再减了哇");
                    }

                });
            });
        </script>
    </head>
    <body>
        <input type="button" value="-" id="minus">
        <input type="text" value="0" id="num">
        <input type="button" value="+" id="add">
    </body>
</html>